<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MagTwin: magtwin/include/MagGraphicsView.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">MagTwin<span id="projectnumber">&#160;V0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_86ea7a88b15d1db1fc6dc4fd1a380af7.html">magtwin</a></li><li class="navelem"><a class="el" href="dir_342feebb14a129b34efa15137427ce30.html">include</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">MagGraphicsView.h</div></div>
</div><!--header-->
<div class="contents">
<a href="_mag_graphics_view_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00008" name="l00008"></a><span class="lineno">    8</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00009" name="l00009"></a><span class="lineno">    9</span> </div>
<div class="line"><a id="l00010" name="l00010"></a><span class="lineno">   10</span><span class="preprocessor">#include &lt;QGraphicsView&gt;</span></div>
<div class="line"><a id="l00011" name="l00011"></a><span class="lineno">   11</span><span class="preprocessor">#include &lt;QGraphicsScene&gt;</span></div>
<div class="line"><a id="l00012" name="l00012"></a><span class="lineno">   12</span><span class="preprocessor">#include &lt;QWheelEvent&gt;</span></div>
<div class="line"><a id="l00013" name="l00013"></a><span class="lineno">   13</span><span class="preprocessor">#include &lt;QLabel&gt;</span></div>
<div class="line"><a id="l00014" name="l00014"></a><span class="lineno">   14</span><span class="preprocessor">#include &lt;QMouseEvent&gt;</span></div>
<div class="line"><a id="l00015" name="l00015"></a><span class="lineno">   15</span><span class="preprocessor">#include &lt;QTransform&gt;</span></div>
<div class="line"><a id="l00016" name="l00016"></a><span class="lineno">   16</span><span class="preprocessor">#include &lt;QPushButton&gt;</span></div>
<div class="line"><a id="l00017" name="l00017"></a><span class="lineno">   17</span><span class="preprocessor">#include &lt;QGraphicsRectItem&gt;</span></div>
<div class="line"><a id="l00018" name="l00018"></a><span class="lineno">   18</span><span class="preprocessor">#include &lt;QPolygonF&gt;</span></div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#include &lt;QList&gt;</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span><span class="preprocessor">#include &quot;<a class="code" href="_g_mesh_8h.html">GMesh.h</a>&quot;</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span> </div>
<div class="foldopen" id="foldopen00027" data-start="{" data-end="};">
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno"><a class="line" href="class_mag_graphics_view.html">   27</a></span><span class="keyword">class </span><a class="code hl_class" href="class_mag_graphics_view.html">MagGraphicsView</a> : <span class="keyword">public</span> QGraphicsView</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span>{</div>
<div class="line"><a id="l00029" name="l00029"></a><span class="lineno">   29</span>    Q_OBJECT</div>
<div class="line"><a id="l00030" name="l00030"></a><span class="lineno">   30</span><span class="keyword">private</span>:</div>
<div class="line"><a id="l00031" name="l00031"></a><span class="lineno">   31</span>    QGraphicsScene *scene; <span class="comment">// 图形场景</span></div>
<div class="line"><a id="l00032" name="l00032"></a><span class="lineno">   32</span>    QLabel *coordinateLabel; <span class="comment">// 鼠标坐标标签</span></div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno">   33</span>    QPoint lastPos; <span class="comment">// 上一次鼠标位置记录</span></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span><span class="keyword">public</span>:</div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno">   39</span>    <a class="code hl_function" href="class_mag_graphics_view.html#a9175a33e8e2739d3e5e632c6c2715da7">MagGraphicsView</a>(QWidget *parent = <span class="keyword">nullptr</span>);</div>
<div class="line"><a id="l00043" name="l00043"></a><span class="lineno">   43</span>    <a class="code hl_function" href="class_mag_graphics_view.html#a026b98b72cf9edb611cc998d529587d8">~MagGraphicsView</a>();</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a3d0f9f9a0d29d1fe8ec9645b38f9721d">addPoint</a>(QList&lt;QPointF&gt; Points);</div>
<div class="line"><a id="l00053" name="l00053"></a><span class="lineno">   53</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#aff7c12efbb55fcda4f29e932ff891ce0">addLine</a>(QList&lt;QPointF&gt; Points);</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#aa565f78d8f8e2897335665b2536032f6">addRriangle</a>(QList&lt;QPointF&gt; Points);</div>
<div class="line"><a id="l00062" name="l00062"></a><span class="lineno">   62</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a79d8615756b7c80bd17ce15f68babe67">clearCanvas</a>();</div>
<div class="line"><a id="l00063" name="l00063"></a><span class="lineno">   63</span><span class="keyword">public</span> slots:</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno">   68</span>    <span class="keywordtype">void</span> <a class="code hl_slot" href="class_mag_graphics_view.html#a9efcab8c2747320e9c469cc77acdf11a">showMesh</a>(<span class="keyword">const</span> <a class="code hl_class" href="class_g_mesh.html">GMesh</a>&amp; mesh);</div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno">   73</span>    <span class="keywordtype">void</span> <a class="code hl_slot" href="class_mag_graphics_view.html#a06c0fbf0bb356cb2fdaa7e1af0e6b025">resizeGraphics</a>(<a class="code hl_class" href="class_mag_graphics_view.html">MagGraphicsView</a>* ShowGraphics);</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno">   74</span><span class="keyword">protected</span>:</div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno">   79</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a5522102a95e0a3b8d08bc9dccce5063e">wheelEvent</a>(QWheelEvent *event) <span class="keyword">override</span>; </div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a880c0681111672605333b1c15b567b1c">mousePressEvent</a>(QMouseEvent *event) <span class="keyword">override</span>; </div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno">   89</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a795ba880577b0ed3d11266f75734c73c">mouseMoveEvent</a>(QMouseEvent *event) <span class="keyword">override</span>; </div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno">   94</span>    <span class="keywordtype">void</span> <a class="code hl_function" href="class_mag_graphics_view.html#a583b7e56e1f37c7f372a0b47a0b21ef0">mouseReleaseEvent</a>(QMouseEvent *event) <span class="keyword">override</span>; </div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno">   99</span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="class_mag_graphics_view.html#aa8eb070a34aba2fc4de03130557f46be">eventFilter</a>(QObject *obj, QEvent *event) <span class="keyword">override</span>; </div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno">  100</span>};</div>
</div>
<div class="ttc" id="a_g_mesh_8h_html"><div class="ttname"><a href="_g_mesh_8h.html">GMesh.h</a></div><div class="ttdoc">Gmsh类是用来提取Gmsh网格文件中的网格信息</div></div>
<div class="ttc" id="aclass_g_mesh_html"><div class="ttname"><a href="class_g_mesh.html">GMesh</a></div><div class="ttdoc">Gmsh类是用来提取Gmsh网格文件中的网格信息</div><div class="ttdef"><b>Definition</b> GMesh.h:26</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html"><div class="ttname"><a href="class_mag_graphics_view.html">MagGraphicsView</a></div><div class="ttdoc">图形视图类</div><div class="ttdef"><b>Definition</b> MagGraphicsView.h:28</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a026b98b72cf9edb611cc998d529587d8"><div class="ttname"><a href="class_mag_graphics_view.html#a026b98b72cf9edb611cc998d529587d8">MagGraphicsView::~MagGraphicsView</a></div><div class="ttdeci">~MagGraphicsView()</div><div class="ttdoc">析构函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:19</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a06c0fbf0bb356cb2fdaa7e1af0e6b025"><div class="ttname"><a href="class_mag_graphics_view.html#a06c0fbf0bb356cb2fdaa7e1af0e6b025">MagGraphicsView::resizeGraphics</a></div><div class="ttdeci">void resizeGraphics(MagGraphicsView *ShowGraphics)</div><div class="ttdoc">将显示的图形缩放到合适大小</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:95</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a3d0f9f9a0d29d1fe8ec9645b38f9721d"><div class="ttname"><a href="class_mag_graphics_view.html#a3d0f9f9a0d29d1fe8ec9645b38f9721d">MagGraphicsView::addPoint</a></div><div class="ttdeci">void addPoint(QList&lt; QPointF &gt; Points)</div><div class="ttdoc">向场景中添加点</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:21</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a5522102a95e0a3b8d08bc9dccce5063e"><div class="ttname"><a href="class_mag_graphics_view.html#a5522102a95e0a3b8d08bc9dccce5063e">MagGraphicsView::wheelEvent</a></div><div class="ttdeci">void wheelEvent(QWheelEvent *event) override</div><div class="ttdoc">重写鼠标滚轮事件处理函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:49</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a583b7e56e1f37c7f372a0b47a0b21ef0"><div class="ttname"><a href="class_mag_graphics_view.html#a583b7e56e1f37c7f372a0b47a0b21ef0">MagGraphicsView::mouseReleaseEvent</a></div><div class="ttdeci">void mouseReleaseEvent(QMouseEvent *event) override</div><div class="ttdoc">重写鼠标释放事件处理函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:76</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a795ba880577b0ed3d11266f75734c73c"><div class="ttname"><a href="class_mag_graphics_view.html#a795ba880577b0ed3d11266f75734c73c">MagGraphicsView::mouseMoveEvent</a></div><div class="ttdeci">void mouseMoveEvent(QMouseEvent *event) override</div><div class="ttdoc">重写鼠标移动事件处理函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:66</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a79d8615756b7c80bd17ce15f68babe67"><div class="ttname"><a href="class_mag_graphics_view.html#a79d8615756b7c80bd17ce15f68babe67">MagGraphicsView::clearCanvas</a></div><div class="ttdeci">void clearCanvas()</div><div class="ttdoc">清空场景</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:127</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a880c0681111672605333b1c15b567b1c"><div class="ttname"><a href="class_mag_graphics_view.html#a880c0681111672605333b1c15b567b1c">MagGraphicsView::mousePressEvent</a></div><div class="ttdeci">void mousePressEvent(QMouseEvent *event) override</div><div class="ttdoc">重写鼠标按下事件处理函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:58</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a9175a33e8e2739d3e5e632c6c2715da7"><div class="ttname"><a href="class_mag_graphics_view.html#a9175a33e8e2739d3e5e632c6c2715da7">MagGraphicsView::MagGraphicsView</a></div><div class="ttdeci">MagGraphicsView(QWidget *parent=nullptr)</div><div class="ttdoc">构造函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:5</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_a9efcab8c2747320e9c469cc77acdf11a"><div class="ttname"><a href="class_mag_graphics_view.html#a9efcab8c2747320e9c469cc77acdf11a">MagGraphicsView::showMesh</a></div><div class="ttdeci">void showMesh(const GMesh &amp;mesh)</div><div class="ttdoc">显示网格</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:111</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_aa565f78d8f8e2897335665b2536032f6"><div class="ttname"><a href="class_mag_graphics_view.html#aa565f78d8f8e2897335665b2536032f6">MagGraphicsView::addRriangle</a></div><div class="ttdeci">void addRriangle(QList&lt; QPointF &gt; Points)</div><div class="ttdoc">向场景中添加三角形</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:41</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_aa8eb070a34aba2fc4de03130557f46be"><div class="ttname"><a href="class_mag_graphics_view.html#aa8eb070a34aba2fc4de03130557f46be">MagGraphicsView::eventFilter</a></div><div class="ttdeci">bool eventFilter(QObject *obj, QEvent *event) override</div><div class="ttdoc">重写事件过滤器函数</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:84</div></div>
<div class="ttc" id="aclass_mag_graphics_view_html_aff7c12efbb55fcda4f29e932ff891ce0"><div class="ttname"><a href="class_mag_graphics_view.html#aff7c12efbb55fcda4f29e932ff891ce0">MagGraphicsView::addLine</a></div><div class="ttdeci">void addLine(QList&lt; QPointF &gt; Points)</div><div class="ttdoc">向场景中添加线</div><div class="ttdef"><b>Definition</b> MagGraphicsView.cpp:37</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>
